{{-- ══ HEADER: LOGO + COMPANY ══ --}}
{{ $warehouse->name }}
{{ $warehouse->address }}
@if($warehouse->phone) {{ $warehouse->phone }}  |  @endif {{ $warehouse->email }}
@if($warehouse->gstin)
GSTIN: {{ $warehouse->gstin }}
@endif
{{-- ══ INVOICE TYPE BAND ══ --}}
@if($order->order_type == "purchases") {{ $traslations['purchase_invoice'] }} @elseif($order->order_type == "purchase-returns") {{ $traslations['purchase_return_invoice'] }} @elseif($order->order_type == "sales-returns") {{ $traslations['sales_return_invoice'] }} @elseif($order->order_type == "sales") {{ $traslations['sales_invoice'] }} @elseif($order->order_type == "quotations") {{ $traslations['quotation_invoice'] }} @endif {{ $traslations['invoice'] }} # {{ $order->invoice_number }}
{{-- ══ META STRIP: DATE / STATUS / SOLD BY ══ --}}
{{ $traslations['order_date'] }} {{ $order->order_date->format($dateTimeFormat) }} {{ $traslations['order_status'] }} {{ $orderStatusText }} {{ $traslations['payment_status'] }} {{ $paymentStatusText }} {{ $traslations['sold_by'] }} {{ $staffMember?->name }}
{{-- ══ SELLER & BUYER ══ --}}
@if($order->order_type == "sales" || $order->order_type == "sales-returns" || $order->order_type == "quotations") {{ $traslations['seller'] }} @else {{ $traslations['buyer'] }} @endif
{{ $warehouse->name }}
{{ $warehouse->address }}
@if($warehouse->phone){{ $warehouse->phone }}
@endif {{ $warehouse->email }}
@if($warehouse->gstin)
GSTIN: {{ $warehouse->gstin }}
@endif
@if($order->order_type == "sales" || $order->order_type == "sales-returns" || $order->order_type == "quotations") {{ $traslations['buyer'] }} @else {{ $traslations['seller'] }} @endif
@if($order->order_type == 'stock-transfers')
{{ $order->warehouse->name }}
{{ $order->warehouse->address }}
{{ $order->warehouse->phone }}
{{ $order->warehouse->email }}
@else
{{ $order->user->name }}
@if($order->user->address || $order->user->city) {{ $order->user->address }} {{ $order->user->city }} {{ $order->user->zipcode }}
@endif @if($order->user->phone){{ $order->user->phone }}
@endif {{ $order->user->email }}
@if(isset($order->user->gstin) && $order->user->gstin)
GSTIN: {{ $order->user->gstin }}
@endif @endif
{{-- ══ ITEMS TABLE ══ --}} @if($order->warehouse->show_mrp_on_invoice) @endif @foreach($order->items as $item) @if($order->warehouse->show_mrp_on_invoice) @endif @endforeach
# {{ $traslations['product'] }} HSN/SAC {{ $traslations['quantity'] }}{{ $traslations['mrp'] }}{{ $traslations['unit_price'] }} Tax {{ $traslations['total'] }}
{{ $loop->iteration }}
{{ $item->product->name }}
@if(isset($item->product->hsn_code) && $item->product->hsn_code)
HSN: {{ $item->product->hsn_code }}
@endif
{{ isset($item->product->hsn_code) ? $item->product->hsn_code : '-' }} {{ $item->quantity . ' ' . $item->unit->short_name }}{{ App\Classes\Common::formatAmountCurrency($company->currency, $item->mrp) }}{{ App\Classes\Common::formatAmountCurrency($company->currency, $item->single_unit_price) }} @if($order->tax_rate > 0) {{ $order->tax_rate }}% @else - @endif {{ App\Classes\Common::formatAmountCurrency($company->currency, $item->subtotal) }}
{{-- ══ GST BREAKUP TABLE ══ --}} @if($order->tax_amount > 0)
HSN/SAC Taxable Value CGST Rate CGST Amt SGST Rate SGST Amt IGST Rate IGST Amt Total Tax
{{ isset($order->items->first()->product->hsn_code) ? $order->items->first()->product->hsn_code : '-' }} {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->subtotal) }} {{ $order->tax_rate/2 }}% {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->tax_amount/2) }} {{ $order->tax_rate/2 }}% {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->tax_amount/2) }} - - {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->tax_amount) }}
Total {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->tax_amount/2) }} {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->tax_amount/2) }} - {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->tax_amount) }}
@endif {{-- ══ TOTALS + AMOUNT IN WORDS ══ --}}
{{-- Amount in words --}}
Amount in Words {{ App\Classes\Common::convertNumberToWords($order->total) }}
{{-- Payment mode --}}
{{ $traslations['payment_mode'] }}: @if($order->orderPayments) @foreach ($order->orderPayments as $p) {{ App\Classes\Common::formatAmountCurrency($company->currency, $p->amount) }} @if($p->payment && $p->payment->paymentMode) ({{ $p->payment->paymentMode->name }}) @endif @endforeach @else - @endif
{{-- QR Code --}} @if(file_exists(public_path('images/qrcode.png')))
Scan to Pay via UPI
@endif
@if($order->tax_amount > 0) @endif @if($order->discount > 0) @endif @if($order->shipping > 0) @endif
{{ $traslations['subtotal'] }} {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->subtotal) }}
CGST ({{ $order->tax_rate/2 }}%) {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->tax_amount/2) }}
SGST ({{ $order->tax_rate/2 }}%) {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->tax_amount/2) }}
{{ $traslations['discount'] }} - {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->discount) }}
{{ $traslations['shipping'] }} {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->shipping) }}
{{ $traslations['total'] }} {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->total) }}
{{-- ══ PAYMENT STATUS ROW ══ --}}
Total Items / Qty {{ $order->total_items }} / {{ $order->total_quantity }} {{ $traslations['paid_amount'] }} {{ $traslations['due_amount'] }} {{ App\Classes\Common::formatAmountCurrency($company->currency, $order->due_amount) }}
{{-- ══ WHATSAPP SHARE BUTTON ══ --}} @php $rawPhone = $order->user->phone ?? ''; $cleanPhone = preg_replace('/[^0-9]/', '', $rawPhone); if(strlen($cleanPhone) == 10) { $waPhone = '91' . $cleanPhone; } elseif(str_starts_with($cleanPhone, '0')) { $waPhone = '91' . substr($cleanPhone, 1); } else { $waPhone = $cleanPhone; } $pdfUrl = url('/api/v1/pdf/' . $order->unique_id . '/en'); $waMessage = "*Invoice from " . $warehouse->name . "*\n" . "-------------------\n" . "Invoice No : *" . $order->invoice_number . "*\n" . "Date : " . $order->order_date->format('d M Y') . "\n" . "Customer : " . $order->user->name . "\n" . "-------------------\n" . "Subtotal : " . ($company->currency->symbol ?? 'Rs.') . number_format($order->subtotal, 2) . "\n" . "GST : " . ($company->currency->symbol ?? 'Rs.') . number_format($order->tax_amount, 2) . "\n" . "*Total : " . ($company->currency->symbol ?? 'Rs.') . number_format($order->total, 2) . "*\n" . "-------------------\n" . "Status : " . ucfirst($order->payment_status) . "\n" . "Due Amount : " . ($company->currency->symbol ?? 'Rs.') . number_format($order->due_amount, 2) . "\n\n" . "Download Invoice PDF:\n" . $pdfUrl . "\n\n" . "Thank you for your business.\n" . $warehouse->name; $waUrl = ($waPhone && strlen($waPhone) >= 10) ? 'https://wa.me/' . $waPhone . '?text=' . rawurlencode($waMessage) : 'https://wa.me/?text=' . rawurlencode($waMessage); @endphp
@if($order->user->phone)
Sending to: {{ $order->user->name }}  |  {{ $order->user->phone }}
@else
⚠ No phone number found — WhatsApp will open without a recipient
@endif
PDF download link included in message
{{-- ══ FOOTER: NOTES / TERMS / SIGNATURE ══ --}}
This is a Computer Generated Invoice